<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of polynomialCurveFit</title>
  <meta name="keywords" content="polynomialCurveFit">
  <meta name="description" content="POLYNOMIALCURVEFIT fit a polynomial curve to a series of points">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="#">imael</a> &gt; <a href="#">geom2d</a> &gt; polynomialCurveFit.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for .\imael\geom2d&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>polynomialCurveFit
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>POLYNOMIALCURVEFIT fit a polynomial curve to a series of points</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function varargout = polynomialCurveFit(t, varargin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">POLYNOMIALCURVEFIT fit a polynomial curve to a series of points

   [XC YC] = polynomialCurveFit(T, XT, YT, ORDER)
   T is a Nx1 vector
   XT and YT are coordinate for each parameter value (column vectors)
   ORDER is the degree of the polynomial used for interpolation
   XC and YC are polynomial coefficients, given in ORDER+1 row vectors,
   starting from degree 0 and up to degree ORDER.

    [XC YC] = polynomialCurveFit(T, POINTS, ORDER);
   specifies coordinate of points in a Nx2 array.

   Example:
   N = 50;
   t = linspace(0, 3*pi/4, N)';
   xp = cos(t); yp = sin(t);
   [xc yc] = polynomialCurveFit(t, xp, yp, 3);
   curve = polynomialCurvePoint(t, xc, yc);
   drawCurve(curve);


    [XC YC] = polynomialCurveFit(..., T_I, COND_I);
   Impose some specific conditions. T_I is a value of the parametrization
   variable. COND_I is a cell array, with 2 columns, and as many rows as
   the derivatives specified for the given T_I. Format for COND_I is:
   COND_I = {X_I, Y_I; X_I', Y_I'; X_I&quot;, Y_I&quot;; ...};
   with X_I and Y_I being the imposed coordinate at position T_I, X_I' and
   Y_I' being the imposed first derivatives, X_I&quot; and Y_I&quot; the imposed
   second derivatives, and so on...
   To specify a derivative without specifying derivative with lower
   degree, value of lower derivative can be let empty, using '[]'

   Example:
   % defines a curve (circle arc) with small perturbations
   N = 100;
   t = linspace(0, 3*pi/4, N)';
   xp = cos(t)+.1*randn(size(t)); yp = sin(t)+.1*randn(size(t));
   
   % plot the points
   figure(1); clf; hold on;
   axis([-1.2 1.2 -.2 1.2]); axis equal;
   drawPoint(xp, yp);

   % fit without knowledge on bounds
   [xc0 yc0] = polynomialCurveFit(t, xp, yp, 5);
   curve0 = polynomialCurvePoint(t, xc0, yc0);
   drawCurve(curve0);

   % fit by imposing coordinate on first point
   [xc1 yc1] = polynomialCurveFit(t, xp, yp, 5, 0, {1, 0});
   curve1 = polynomialCurvePoint(t, xc1, yc1);
   drawCurve(curve1, 'r');

   % fit by imposing coordinate (1,0) and derivative (0,1) on first point
   [xc2 yc2] = polynomialCurveFit(t, xp, yp, 5, 0, {1, 0;0 1});
   curve2 = polynomialCurvePoint(t, xc2, yc2);
   drawCurve(curve2, 'g');

   % fit by imposing several conditions on various points
   [xc3 yc3] = polynomialCurveFit(t, xp, yp, 5, ...
       0, {1, 0;0 1}, ...      % coord and first derivative of first point
       3*pi/4, {-sqrt(2)/2, sqrt(2)/2}, ...    % coord of last point
       pi/2, {[], [];-1, 0});      % derivative of point on the top of arc
   curve3 = polynomialCurvePoint(t, xc3, yc3);
   drawCurve(curve3, 'k');

   Requires the optimization Toolbox.


   Examples:
   polynomialCurveFit

   See also
   <a href="polynomialCurves2d.html" class="code" title="function polynomialCurves2d(varargin)">polynomialCurves2d</a>

 ------
 Author: David Legland
 e-mail: david.legland@nantes.inra.fr
 Created: 2007-02-27
 Copyright 2007 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas.
 Licensed under the terms of the LGPL, see the file &quot;license.txt&quot;</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="polynomialCurveSetFit.html" class="code" title="function varargout = polynomialCurveSetFit(seg, varargin)">polynomialCurveSetFit</a>	POLYNOMIALCURVESETFIT fit a set of polynomial curves to a segmented image</li></ul>
<!-- crossreference -->



<hr><address>Generated on Fri 05-Feb-2010 11:20:41 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>